﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace DataMaginev.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ValuesController : ControllerBase
    {

        public ValuesController() { }
        //   /api/values/t1
        [HttpPost("t1")]
        public ActionResult test1([FromForm] string SStation, [FromForm] string? Type)
        {
            string message = string.Empty;
            if (string.IsNullOrEmpty(SStation))
            {
                message = $"缺少[SStation]参数！";
                return Ok(new { code = 201, message });
            }
            if (string.IsNullOrEmpty(Type))
            {
                message = $"缺少[Type]参数！";
                return Ok(new { code = 201, message });
            }
            switch (Type)
            {
                case "Air":
                    message = "填写正确Air";
                    break;
                case "Dbs":
                    message = "填写正确Dbs";
                    break;
            }

            return Ok(new { code = 200, message });
        }
        //   /api/values/t2
        [HttpPost("t2")]
        public ActionResult test2([FromForm] string message)
        {
           
            return Ok(new { code = 200, message });
        }
    }
}
